﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BillGuru
{
    public partial class FrmStockAdjustmentReason : Form
    {
        public FrmStockAdjustmentReason()
        {
            InitializeComponent();
        }

        private void stockAdjustmentReasonBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            SaveStockAdjustmentReason();

        }

        private void SaveStockAdjustmentReason()
        {
            this.Validate();
            this.stockAdjustmentReasonBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.billGuruDataSet);
        }

        private void FrmOtherConfiguration_Load(object sender, EventArgs e)
        {
            this.stockAdjustmentReasonTableAdapter.Fill(this.billGuruDataSet.StockAdjustmentReason);
            this.stockAdjustmentReasonTableAdapter.Adapter.RowUpdated += new System.Data.OleDb.OleDbRowUpdatedEventHandler(Adapter_RowUpdated);

        }

        void Adapter_RowUpdated(object sender, System.Data.OleDb.OleDbRowUpdatedEventArgs e)
        {
            BillGuru.Persistence.SharedEventHandlerImpl.RetrieveKeyOnRowInsert(sender, e);
        }

        private void pbSave_Click(object sender, EventArgs e)
        {
            SaveStockAdjustmentReason();
        }

        private void FrmStockAdjustmentReason_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.billGuruDataSet.HasChanges())
                BillGuru.UI.PermissionHandler.checkDataLoss(e);
        }
    }
}
